<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Custom log format support</title>
<link rel="stylesheet" href="../../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../../index.html" title="Boost.Test">
<link rel="up" href="../logging_api.html" title="Logging API">
<link rel="prev" href="log_ct_log_format.html" title="Predefined log format selection">
<link rel="next" href="../test_output_progress.html" title="Progress display">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="log_ct_log_format.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../logging_api.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../test_output_progress.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h4 class="title">
<a name="boost_test.test_output.logging_api.custom_log_formatter"></a><a name="ref_log_formatter_api"></a><a class="link" href="custom_log_formatter.html" title="Custom log format support">Custom
        log format support</a>
</h4></div></div></div>
<p>
          It is possible to implement your own formatter: it should derive from
          <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_formatter.html" title="Class unit_test_log_formatter">boost::unit_test::unit_test_log_formatter</a></code>.
        </p>
<p>
          It is possible to add a your own instance of a formatter to the set of
          formats using one of the two functions:
        </p>
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">unit_test_log</span><span class="special">.</span><span class="identifier">set_formatter</span><span class="special">(</span> <span class="identifier">unit_test_log_formatter</span><span class="special">*</span> <span class="special">);</span>
<span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">unit_test_log</span><span class="special">.</span><span class="identifier">add_formatter</span><span class="special">(</span> <span class="identifier">unit_test_log_formatter</span><span class="special">*</span> <span class="special">);</span>
</pre>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top"><p>
            See <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_t.html#idm47459-bb">boost::unit_test::unit_test_log_t::set_formatter</a></code>
            and <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_t.html#idm47481-bb">boost::unit_test::unit_test_log_t::add_formatter</a></code>
            for more details
          </p></td></tr>
</table></div>
<div class="warning"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../../../doc/src/images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>
            The call to <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">unit_test_log</span><span class="special">.</span><span class="identifier">set_formatter</span></code> is equivalent to <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_t.html#idm47438-bb">boost::unit_test::unit_test_log_t::set_format</a></code>
            (<a class="link" href="log_ct_log_format.html" title="Predefined log format selection">see
            here</a>) as it disables all other formatters.
          </p></td></tr>
</table></div>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../doc/src/images/tip.png"></td>
<th align="left">Tip</th>
</tr>
<tr><td align="left" valign="top">
<p>
            More details about the class implementing the formatting of the logs
            can be found in the following reference sections:
          </p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
                <code class="computeroutput"><a class="link" href="../../../boost/unit_test/unit_test_log_formatter.html" title="Class unit_test_log_formatter">boost::unit_test::unit_test_log_formatter</a></code>
                defines the interface for all loggers. Built-in <a class="link" href="../log_formats/log_human_readable_format.html" title="HRF: Human readable log format">HRF</a>,
                <a class="link" href="../log_formats/log_xml_format.html" title="XML log format">XML</a>
                and <a class="link" href="../log_formats/log_junit_format.html" title="JUNIT log format">JUNIT</a>
                loggers derive from this class
              </li>
<li class="listitem">
                <code class="computeroutput"><a class="link" href="../../../boost/unit_test/test_results.html" title="Class test_results">boost::unit_test::test_results</a></code>
                defines the information carried by the tests to provide reports and
                logs.
              </li>
</ul></div>
</td></tr>
</table></div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2001-2022 Boost.Test contributors<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="log_ct_log_format.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../logging_api.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="../test_output_progress.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
